package hu.myai.model.graph;

public class DirectionNode extends AbstractNode {

	public static final int SIDE_WAY = 0;

	public static final int LOCAL_HIGH = 1;

	public static final int LOCAL_LOW = -1;

	public static final int SEASON_HIGH = 2;

	public static final int SEASON_LOW = -2;

	private int direction;

	/**
	 * Default constructor
	 */
	public DirectionNode() {
	}

	public int getDirection() {
		return direction;
	}

	public void setDirection(int direction) {
		this.direction = direction;
	}

	/**
	 * @param direction
	 *            main attribute of DirectionNode
	 * @return the most relevant DirectionNode regarding the given direction
	 */
	public DirectionNode getNext(int direction) {
		for (AbstractNode nextNode : nextNodeList) {
			if (direction == ((DirectionNode) nextNode).getDirection()) {
				return (DirectionNode) nextNode;
			}
		}
		log.error("No next DirectionNode: " + direction);
		return this;
	}
}
